<template>
  <el-card shadow="never" class="aui-card--fill">
    <div class="mod-adx__reportresult}">
      <el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
        <el-form-item label="转化类型" >
                    <el-select v-model="dataForm.resultType"  placeholder="转化类型" clearable >
              <el-option v-for="data in resultTypeList" :key="data.dictLabel" :label="data.dictLabel" :value="data.dictValue"></el-option>
            </el-select>
            </el-form-item>
          <el-form-item label="投放起始时间">
                   <el-date-picker
                      v-model="dataForm.stime"
                      value-format="yyyy-MM-dd"
                      type="date"
                      placeholder="投放起始时间">
                    </el-date-picker>
            </el-form-item>
              <el-form-item label="投放结束时间">
                     <el-date-picker
                        v-model="dataForm.etime"
                        value-format="yyyy-MM-dd"
                        type="date"
                        placeholder="投放结束时间">
                      </el-date-picker>
              </el-form-item>

              <el-form-item label="账户">
          <el-select v-model="dataForm.dspId" placeholder="请选择对应的账户" clearable>
                <el-option
                  v-for="item in dspIdList "
                  :key="item.dictValue"
                  :label="item.dictLabel"
                  :value="item.dictValue">
                </el-option>
              </el-select>
        </el-form-item>
       
        <el-form-item>
          <el-button @click="getDataList()">{{ $t('query') }}</el-button>
        </el-form-item>
        <!-- <el-form-item>
          <el-button type="info" @click="exportHandle()">{{ $t('export') }}</el-button>
        </el-form-item>
        <el-form-item>
          <el-button v-if="$hasPermission('adx:reportresult:save')" type="primary" @click="addOrUpdateHandle()">{{ $t('add') }}</el-button>
        </el-form-item>
        <el-form-item>
          <el-button v-if="$hasPermission('adx:reportresult:delete')" type="danger" @click="deleteHandle()">{{ $t('deleteBatch') }}</el-button>
        </el-form-item> -->
      </el-form>
      <el-table v-loading="dataListLoading" :data="dataList" border @selection-change="dataListSelectionChangeHandle" style="width: 100%;">
        <el-table-column type="selection" header-align="center" align="center" width="50"></el-table-column>
        <el-table-column prop="id" v-if="false" label="主键" header-align="center" align="center"></el-table-column>
        <el-table-column prop="date" label="日期"  header-align="center" align="center"></el-table-column>
        <el-table-column prop="total" label="数量" header-align="center" align="center"></el-table-column>
        <el-table-column prop="campaignId" label="计划ID" header-align="center" align="center"></el-table-column>
        <el-table-column prop="adgroupId" label="任务ID" header-align="center" align="center"></el-table-column>
        <el-table-column prop="contentId" label="素材ID" header-align="center" align="center"></el-table-column>
        <el-table-column prop="channel" label="上报的渠道" header-align="center" align="center">
          <template slot-scope="scope">
            <el-tag >华为</el-tag>
          </template>
        </el-table-column>
        <el-table-column prop="resultType" label="业务类型" header-align="center" align="center">
          <template slot-scope="scope">
            {{ $getDictLabel("resultType", scope.row.resultType) }}
          </template>
        </el-table-column>

        <el-table-column prop="dspId" label="DSP账户" header-align="center" align="center">
          <template slot-scope="scope">
              {{ $getDictLabel("dspIdList", scope.row.dspId) }}
          </template>
        </el-table-column>
     

        <!-- <el-table-column prop="createTime" label="创建时间" header-align="center" align="center"></el-table-column> -->
        <el-table-column :label="$t('handle')" fixed="right" header-align="center" align="center" width="150">
          <template slot-scope="scope">
            <!-- <el-button v-if="$hasPermission('adx:reportresult:update')" type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">{{ $t('update') }}</el-button>
            <el-button v-if="$hasPermission('adx:reportresult:delete')" type="text" size="small" @click="deleteHandle(scope.row.id)">{{ $t('delete') }}</el-button> -->
          </template>
        </el-table-column>
      </el-table>
      <el-pagination
        :current-page="page"
        :page-sizes="[10, 20, 50, 100]"
        :page-size="limit"
        :total="total"
        layout="total, sizes, prev, pager, next, jumper"
        @size-change="pageSizeChangeHandle"
        @current-change="pageCurrentChangeHandle">
      </el-pagination>
      <!-- 弹窗, 新增 / 修改 -->
      <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
    </div>
  </el-card>
</template>

<script>
import mixinViewModule from '@/mixins/view-module'
import AddOrUpdate from './reportresult-add-or-update'
import { getDictDataList } from '@/utils'
export default {
  mixins: [mixinViewModule],
  data () {
    return {
      mixinViewModuleOptions: {
        getDataListURL: '/adx/reportresult/page',
        getDataListIsPage: true,
        exportURL: '/adx/reportresult/export',
        deleteURL: '/adx/reportresult',
        deleteIsBatch: true
      },
      dataForm: {
        id: '',
        stime: '',
        etime: '',
      },
      resultTypeList:[],
      dspIdList:[]
    }
  },
  mounted(){
    this.getResultType();
    this.getDspIdDict();
  },
  components: {
    AddOrUpdate
  },
  methods: {
    getResultType(){
      this.resultTypeList=getDictDataList("resultType")
    },
    getDspIdDict(){
      this.dspIdList=getDictDataList("dspIdList")
     
    }
  }
}
</script>
